import subprocess

if __name__ == "__main__":
    try:
        command = [
            "uvicorn",
            "automaticAI.src.api.endpoints.automation:router",
            "--host", "0.0.0.0",
            "--port", "8000",
            "--reload"
        ]
        subprocess.run(command, check=True)
    except subprocess.CalledProcessError as e:
        print(f"启动服务器时出现错误: {e}")
    except FileNotFoundError:
        print("未找到 uvicorn 命令，请确保已经安装了 uvicorn。")